package com.qc.wintrax.adapter;

import android.content.Context;
import android.content.Intent;
import android.os.Parcelable;
import android.view.View;

import com.qc.wintrax.R;
import com.qc.wintrax.activity.EditMapInfoActivity;
import com.qc.wintrax.utils.LogUtil;

import java.util.List;

import greendao.LineName;

/**
 * Created by asus on 2016/8/20.
 */
public class LineListAdapter extends CommonAdapter<LineName> {

    private List<LineName>  lineNames;
    private Context mcontext;

    public LineListAdapter(Context context, List<LineName> datas, int layoutId) {
        super(context, datas, layoutId);
        lineNames = datas;
        mcontext = context;
    }

    @Override
    public void convert(ViewHolder holder, final LineName lineName) {
        holder.setText(R.id.name_txt,lineName.getMap_title());
        holder.setOnClickListener(R.id.edit_img, new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String name = lineName.getMap_title();
                long id = lineName.getId();
                LogUtil.e("获取的主键是---"+id);
//                WTApplication.getInstance().setConfig("nameTitle",name);
                Intent intent = new Intent(mcontext, EditMapInfoActivity.class);
                intent.putExtra("id",id);
                intent.putExtra("lineName", lineName);
                mcontext.startActivity(intent);
            }
        });

    }
}
